import 'package:flutter/material.dart';
import 'package:flutter_dva/flutter_dva.dart';

import 'app.dart';
import 'src/models/home.dart';

Dva dva = Dva(DvaOpts(
  initialState: <String, StoreOfState<dynamic>>{
    'home': StoreOfState<CountState>(state: CountState())
  },
  models: <Model<dynamic>>[
    HomeModel()
  ]
));

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  WidgetCreatorFunction app = await dva.start(() => MyApp(), () async {
    final ReduxPersistor persistor = ReduxPersistor(store: dva.store!, heartBeat: 450);
    await persistor.persist();
  }, waitCallabck: true);
  return runApp(app());
}